package com.hfb.mashibing.alip8.interview.jvm.instructionsexecutedorder;


/**
 * 字符串反转
 */
public class StrReverse {
    public static String reverse(String str) {
        int len = str.length();
        if (null == str || len <= 1) {
            return str;
        }

        String left = str.substring(0, len / 2);
        String right = str.substring(len / 2);

        return reverse(right) + reverse(left);
    }

    public static void main(String[] args) {
        String str = "123456789";
        System.out.println(reverse(str));
    }
}
